package com.houhanzhi.manager.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.houhanzhi.manager.ProductManager;
import com.houhanzhi.mapper.ProductMapper;
import com.houhanzhi.model.ProductDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class ProductManagerImpl implements ProductManager {

    @Autowired
    private ProductMapper productMapper;

    /**
     * 商品列表
     * @return
     */
    @Override
    public List<ProductDO> list() {
        return productMapper.selectList(null);
    }

    /**
     * 根据id查询商品详情
     * @param productId
     * @return
     */
    @Override
    public ProductDO findDetailById(long productId) {
        return productMapper.selectOne(new QueryWrapper<ProductDO>().eq("id", productId));
    }
}
